package com.share.notification.client;

import java.lang.management.ManagementFactory;

import javax.management.JMException;
import javax.management.MBeanServer;
import javax.management.ObjectName;

public class HelloAgent
{
	public static void main(String[] args) throws JMException, Exception
	{
		MBeanServer server = ManagementFactory.getPlatformMBeanServer();
		
		ObjectName helloName = new ObjectName("yunge:name=Hello");    
		Hello hello=new Hello();          
		server.registerMBean(hello, helloName);
		
		Jack jack = new Jack();
		server.registerMBean(jack, new ObjectName("jack:name=Jack"));
		
		jack.addNotificationListener(new HelloListener(), null, hello);
		Thread.sleep(500000);
	}
}